package main

import (
	"fmt"
	//"log"
	"GoHTTP/02selfRouter/route"
	"net/http"
)

func GetHello(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "Hello Get!")
}

func main() {
	r := route.NewRouter()
	/*r.HandleFunc("GET", "/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprint(w, "Hello Get!")
	})
	*/
	r.HandleFunc("GET", "/", GetHello)
	r.HandleFunc("POST", "/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprint(w, "hello POST!")
	})
	http.ListenAndServe(":8080", r) //把参数传入进去
}
